home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes reversed ƒ / Mr. Do outdone reversed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.7 KB  |  146 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define    BoxSize    2
  4. #define CorrectTime 3
  5. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  6. #define theWindowWidth (boundsRect.right-boundsRect.left)
  7.  
  8. pascal short MrDoOutdoneReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  9.  
  10. /* 25 regions on screen, in a 5 x 5 grid.  Regions alternate as to whether they
  11.    scroll up or down. */
  12.    
  13. pascal short MrDoOutdoneReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  14. {
  15.     short            x, y;
  16.     short            vgap,hgap;
  17.     Rect        theRect, dest;
  18.     Rect        bounds[25];
  19.     
  20.     vgap=theWindowHeight/5;
  21.     hgap=theWindowWidth/5;
  22.     
  23.     for (x=0; x<25; x++)
  24.     {
  25.         switch (x)
  26.         {
  27.             case 0:
  28.             case 1:
  29.             case 2:
  30.             case 3:
  31.             case 4:
  32.                 bounds[x].top=0;
  33.                 break;
  34.             case 15:
  35.             case 16:
  36.             case 17:
  37.             case 18:
  38.             case 5:
  39.                 bounds[x].top=vgap;
  40.                 break;
  41.             case 14:
  42.             case 23:
  43.             case 24:
  44.             case 19:
  45.             case 6:
  46.                 bounds[x].top=vgap*2;
  47.                 break;
  48.             case 13:
  49.             case 22:
  50.             case 21:
  51.             case 20:
  52.             case 7:
  53.                 bounds[x].top=vgap*3;
  54.                 break;
  55.             case 12:
  56.             case 11:
  57.             case 10:
  58.             case 9:
  59.             case 8:
  60.                 bounds[x].top=vgap*4;
  61.                 break;
  62.         }
  63.         switch (x)
  64.         {
  65.             case 0:
  66.             case 15:
  67.             case 14:
  68.             case 13:
  69.             case 12:
  70.                 bounds[x].left=0;
  71.                 break;
  72.             case 1:
  73.             case 16:
  74.             case 23:
  75.             case 22:
  76.             case 11:
  77.                 bounds[x].left=hgap;
  78.                 break;
  79.             case 2:
  80.             case 17:
  81.             case 24:
  82.             case 21:
  83.             case 10:
  84.                 bounds[x].left=hgap*2;
  85.                 break;
  86.             case 3:
  87.             case 18:
  88.             case 19:
  89.             case 20:
  90.             case 9:
  91.                 bounds[x].left=hgap*3;
  92.                 break;
  93.             case 4:
  94.             case 5:
  95.             case 6:
  96.             case 7:
  97.             case 8:
  98.                 bounds[x].left=hgap*4;
  99.                 break;
  100.         }
  101.         bounds[x].bottom=bounds[x].top+vgap;
  102.         bounds[x].right=bounds[x].left+hgap;
  103.         OffsetRect(&(bounds[x]), boundsRect.left, boundsRect.top);
  104.     }
  105.     
  106.     for (x=BoxSize; x<vgap; x+=BoxSize)
  107.     {        
  108.         StartTiming();
  109.         for (y=0; y<25; y++)
  110.         {
  111.             if (!(y%2))   /* these scroll up */
  112.             {
  113.                 dest=bounds[y];
  114.                 dest.top=dest.bottom-BoxSize;
  115.                 
  116.                 theRect=bounds[y];
  117.                 theRect.top+=x-BoxSize;
  118.                 theRect.bottom=theRect.top+BoxSize;
  119.             
  120.                 ScrollTheRect(&bounds[y], 0, -BoxSize, 0L);
  121.                 CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  122.                         &theRect, &dest, 0, 0L);
  123.             }
  124.             else    /* these scroll down */
  125.             {
  126.                 dest=bounds[y];
  127.                 dest.bottom=dest.top+BoxSize;
  128.                 
  129.                 theRect=bounds[y];
  130.                 theRect.bottom-=x-BoxSize;
  131.                 theRect.top=theRect.bottom-BoxSize;
  132.                 
  133.                 ScrollTheRect(&bounds[y], 0, BoxSize, 0L);
  134.                 CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  135.                         &theRect, &dest, 0, 0L);
  136.             }
  137.         }
  138.         TimeCorrection(CorrectTime);
  139.     }
  140.     
  141.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  142.         &boundsRect, &boundsRect, 0, 0L);        /* in case we missed any */
  143.     
  144.     return 0;
  145. }
  146.